<html lang="en">

<head th:include="templates/common :: header" />

<body>
	<div class="container" style="margin-top: 40px;">
		<div th:include="templates/common :: menu"></div>
		
		<div class="panel panel-primary">
			<div class="panel-heading" th:text="#{'subjects.'+ ${type} + '.label'}"></div>
	  		<div class="panel-body">
				<form id="subjectEditForm" action="#" th:object="${subjectDTO}" th:action="@{'/subjects/' + ${type}}" method="post" class="form-horizontal">
				
						<div class="form-group">
							<span th:if="${#fields.hasErrors('subjectName')}" th:errors="*{subjectName}"/> 
							<label class="col-lg-2 control-label" th:text="#{subjects.table.subject.name}" />
							<div class="col-lg-3">
								<input id="hiddenID" type="hidden" th:field="*{id}" />
								<input id="subjectName" type="text" class="form-control" th:field="*{subjectName}" th:placeholder="#{subjects.table.subject.name}"/>
							</div>
						</div>
		
						 <div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{groups.label}" />
							<div class="col-lg-3">
								<select th:field="*{groups}" id="allGroups" multiple="multiple" class="chzn-select btn-block">
									<option th:each="group : ${allGroups}" th:value="${group.id}" th:text="${group.getGroupFullName()}">Access Type 1</option>
								</select>
							</div>
						</div>
						
						 <div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{teachers.role.name}"/>
							<div class="col-lg-3">
								<select th:field="*{user}" id="allTeachers" class="chzn-select btn-block">
									<option th:each="teacher : ${allTeachers}" th:value="${teacher.id}" th:text="${teacher.getFullName()}">Access Type 1</option>
								</select>
							</div>
						</div>
		
						<div class="form-group">
							<div class="col-lg-offset-2 col-lg-2">
								<button id="submitSubjectForm" type="submit" class="btn btn-primary btn-block" th:text=" ${type} == 'create' ?  #{subjects.create}: #{app.update.data}">Change password</button>
							</div>
						</div>
				</form>
			</div>
		</div>
	</div>
	
	<script type="text/javascript"> 
	 $(document).ready(function() {
	    $('.chzn-select').select2({});
	 });
	</script>
</body>
</html>